package com.china08.yxyapi.entity.db.res;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 中国行政区域编码表
 * 
 * @author Ertao.Fang
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "sys_area", catalog = "yxy_yxy")
public class YxyArea implements Serializable {

    @Id
    @Column(name = "area_id")
    private String areaId;

    @Column(name = "area_name")
    private String areaName;

    @JsonIgnore
    @ManyToOne(targetEntity = YxyArea.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "area_pid", insertable = false, updatable = false)
    private YxyArea parentArea;

    @Column(name = "area_pid")
    private String areaPId;

    // getters and setters

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    @JsonIgnore
    public YxyArea getParentArea() {
        return parentArea;
    }

    public void setParentArea(YxyArea parentArea) {
        this.parentArea = parentArea;
    }

    public String getAreaPId() {
        return areaPId;
    }

    public void setAreaPId(String areaPId) {
        this.areaPId = areaPId;
    }
}
